package com.it.blog.service.impl;

import com.it.blog.domain.Param;
import com.it.blog.mapper.ParamMapper;
import com.it.blog.service.IParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;


@Service
public class ParamServiceImpl implements IParamService {
    @Autowired
    private ParamMapper paramMapper;

    @Override
    public Map<String, String> getParamAll() {
        List<Param> paramList=paramMapper.getParamAll();
        Map<String, String> map = paramList.stream().collect(Collectors.toMap(
                param -> param.getParamKey(),
                param -> param.getParamValue()
        ));
        return map;
    }
}
